<?php
class email
{
	var $from;
	var $to;
	var $subject;
	var $body;
	var $message;
	var $cc;
	var $bcc;
	var $charset;
	var $return_path;

	public function __construct( $to, $subject, $message )
	{
		// parametros obrigatórios, recebidos na instância do objeto //
		$this -> to						= $to;
		$this -> message 			= $message;
		$this -> subject 			= $subject;
		
		// parâmetros opcionais, por padrão recebem: 
		$this -> from							= "Contato <contato@campinasinforma.com.br>";
		$this -> body							= $this->getBody();
		$this -> charset						= "iso-8859-1";
		$this -> return_path					= $this -> from;
		$this -> type							= "text/html";
		$this -> exibeDescadastro = true;
	}

	public function send()
	{
		$this -> headers = "MIME-Version: 1.0\n";
		$this -> headers .= "Content-type: ".$this->type."; charset=".$this->charset."\n";
		$this -> headers .= "From: ".$this->from."\n";
		if( $this -> cc ) $this -> headers .= "Cc: ".$this->cc."\n";
		if( $this -> bcc ) $this -> headers .= "Bcc: ".$this->bcc."\n";
		$this -> headers .= "Return-Path: ".$this->return_path."\n";
		
		if( strpos( $this->to, "@" ) < 1 ) return false;

		return mail( $this->to, $this->subject, $this->getBody(), $this->headers );
	}	

	public function getBody()
	{
		$body = "	<h1 style='font-size: 16px; font-family: Arial, Helvetica, sans-serif;'>". $this->subject ."</h1>";
		$body .= "	<div style='font-size: 11px; font-family: Arial, Helvetica, sans-serif;'>";
		$body .= "		".$this->message;
		$body .= "		<p>&nbsp;</p>";
		$body .= "	</div>";
		$body .= "</div>";

		return $body;
	}
}
?>